import request from '@/utils/request'
import requests from '@/utils/oaRequest'
// 部门下拉菜单
export const getDepartMent=()=>requests({
    //http://localhost:8080/jeecg-boot/sys/sysDepart/queryTreeList?_t=1664352339
    url:'/sys/sysDepart/queryTreeList',
    method:"GET"
})

//  所有部门权限列表  http://localhost:8080/jeecg-boot/sys/role/queryTreeList?_t=1665450988
export const getDepartMentPermission=()=>requests({
    url:'/sys/role/queryTreeList',
    method:"GET"
}) 

//获取部门权限 http://localhost:8080/jeecg-boot/sys/permission/queryDepartPermission?_t=1665453610&departId=f4630762767441939839bb127356fdc2
export const getCurrentDepartmentPermission=(data)=>requests({
    url:`/sys/permission/queryDepartPermission?_t=""&departId=${data.departId}`,
    method:"GET",
    data
})
//  添加部门    http://localhost:8080/jeecg-boot/sys/sysDepart/add
export const adddepartInstitution=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/sysDepart/add`,
    method:"POST",
    data
})
//  部门查询    http://localhost:8080/jeecg-boot/sys/sysDepart/searchBy?_t=1665631655&keyWord=%E8%B4%A2%E5%8A%A1%E9%83%A8
export const searchDepartment=(data)=>requests({
    url:`/sys/sysDepart/searchBy?_t=1665631655&keyWord=${data.input}`,
    method:"GET",
    data
})
//  部门管理    信息保存    http://localhost:8080/jeecg-boot/sys/sysDepart/edit
export const editPreserve=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/sysDepart/edit`,
    method:"PUT",
    data
})
//  部门管理    权限信息保存    http://localhost:8080/jeecg-boot/sys/permission/saveDepartPermission
export const permisisonPreserve = (data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/permission/saveDepartPermission`,
    method:"POST",
    data
})
//  批量删除    http://localhost:8080/jeecg-boot/sys/sysDepart/deleteBatch?ids=8072cb4c3a44424fbed275202872a7d4,b196177ecf9f476ba09478a8a4b56712
export const deleteBatches=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/sysDepart/deleteBatch?ids=${data}`,
    method:"DELETE",
    data
})

//  导出  http://localhost:8080/jeecg-boot/sys/sysDepart/exportXls?_t=1665652694&column=createTime&order=desc&field=id,,departName,orgType,orgCode,mobile,fax,address,departOrder,action&pageNo=1&pageSize=10
export const exportData = (data)=>requests({
    url:`/sys/sysDepart/exportXls?_t=1665652694&column=createTime&order=desc&field=id,,departName,orgType,orgCode,mobile,fax,address,departOrder,action&pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
    method:"GET",
    responseType:'blob',
    data
})
//  职务管理 http://localhost:8080/jeecg-boot/sys/position/list?_t=1665801566&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=1&pageSize=10
export const functionManagement = (data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/list?_t=1665801566&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
    method:"GET",
    data
})

//  职务管理导出    http://localhost:8080/jeecg-boot/sys/position/exportXls?_t=1665813621&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=1&pageSize=10
export const functionManagementExport = (data) =>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/exportXls?_t=1665813621&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
    method:"GET",
    responseType:`blob`,
    data
})

//  职务管理查询    http://localhost:8080/jeecg-boot/sys/position/list?_t=1665968503&code=%E6%80%BB%E7%BB%8F%E7%90%86&postRank=1&name=111&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=1&pageSize=10
export const dutySearch = (data) =>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/list?_t=1665966728&code=*${data.code}*&postRank=*${data.rank}*&name=*${data.name}*&column=createTime&order=desc&field=id,,,code,name,postRank_dictText,action&pageNo=${data.pageNo}&pageSize=${data.pageSize}`,
    method:"get",
    data
})
//  添加职务管理    http://localhost:8080/jeecg-boot/sys/position/add
export const addToDutyTableList = (data) =>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/add`,
    method:"POST",
    data
})
//  职务管理 添加校验   http://localhost:8080/jeecg-boot/sys/duplicate/check?_t=1666336999&tableName=sys_position&fieldName=code&fieldVal=%E7%BB%84%E5%91%98
export const addCheck=(data)=>requests({
    url: `http://localhost:8080/jeecg-boot/sys/duplicate/check?_t=1666336999&tableName=${data.tableName}&fieldName=${data.fieldName}&fieldVal=${data.fieldVal}`,
    method:"GET",
    data
})
// 编辑检查 http://localhost:8080/jeecg-boot/sys/duplicate/check?_t=1665987848&tableName=sys_position&fieldName=code&fieldVal=devleader&dataId=1185040064792571906
export const checkBeforeEdit=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/duplicate/check?_t=1665987848&tableName=sys_position&fieldName=code&fieldVal=${data.code}&dataId=${data.id}`,
    method:"GET",
    data
})
//  编辑    http://localhost:8080/jeecg-boot/sys/position/edit
export const positionEdit=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/edit`,
    method:"PUT",
    data
})


//  
//  职务管理 删除    http://localhost:8080/jeecg-boot/sys/position/delete?id=1581889759186051073
export const deletePosition=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/delete?id=${data.id}`,
    method:"DELETE",
    data
})
//  职务管理 批量删除    http://localhost:8080/jeecg-boot/sys/position/deleteBatch?ids=1581901433032990721,1581901159765696513,
export const deleteChoice = (data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/position/deleteBatch?ids=${data}`,
    method:"delete",
    data
})
//test/sys/sysDepart/queryIdTree
export const sysDepartqueryIdTree=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/sysDepart/queryIdTree?_t=1665546608`,
    methods:"get",
    data
})


// 通讯录 获取右边信息http://localhost:8080/jeecg-boot/sys/user/queryByOrgCodeForAddressList?_t=1666005063&orgCode=A01&column=createTime&order=desc&field=id,,,realname,workNo,departName,post,telephone,email&pageNo=1&pageSize=10
export const getredMesend=(data)=>requests({
    //http://localhost:8080/jeecg-boot/sys/user/queryByOrgCodeForAddressList?_t=1665627433&column=createTime&order=desc&field=id,,,realname,workNo,departName,post,telephone,email&pageNo=1&pageSize=10
    url:`http://localhost:8080/jeecg-boot/sys/user/queryByOrgCodeForAddressList?column=createTime&order=desc&field=id,,,realname,workNo,departName,post,telephone,email&pageNo=${data.pageNo}&pageSize=${data.pageSize}&realname=${data.realname}&workNo=${data.workNo}`,
    method:"GET",
    data
})

// 通讯录 获取右边信息http://localhost:8080/jeecg-boot/sys/user/queryByOrgCodeForAddressList?_t=1666005063&orgCode=A01&column=createTime&order=desc&field=id,,,realname,workNo,departName,post,telephone,email&pageNo=1&pageSize=10
export const getRightMessage=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/user/queryByOrgCodeForAddressList?_t=1666005063&orgCode=${data.orgCode}&column=createTime&order=desc&field=id,,,realname,workNo,departName,post,telephone,email&pageNo=1&pageSize=10`,
    method:"GET",
    data
})

//  通讯录树查询
  //http://localhost:8080/jeecg-boot/sys/sysDepart/queryTreeList?_t=1665737225
export const getDepartMentdicry=(data)=>requests({
    url:`http://localhost:8080/jeecg-boot/sys/sysDepart/searchBy?_t=1665739142&keyWord=${data.input2}`,
    method:"GET",
    data
})

